<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的成就 - 龙虎斗</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            background-attachment: fixed;
            min-height: 100vh;
            color: #333;
            transition: background 0.3s ease;
        }

        /* 主题颜色样式 */
        body.theme-blue {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-green {
            background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-orange {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-purple {
            background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-pink {
            background: linear-gradient(135deg, #fa709a 0%, #fee140 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-red {
            background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-yellow {
            background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-cyan {
            background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-lime {
            background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-indigo {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-teal {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-rose {
            background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-amber {
            background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-emerald {
            background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-sky {
            background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
            background-attachment: fixed !important;
        }

        body.theme-violet {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
            background-attachment: fixed !important;
        }

        .container {
            max-width: 480px;
            margin: 0 auto;
            background: transparent;
            min-height: 100vh;
            position: relative;
        }

        .header {
            background: rgba(102, 126, 234, 0.9);
            backdrop-filter: blur(10px);
            color: white;
            padding: 20px;
            text-align: center;
            position: relative;
            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        }

        .back-btn {
            position: absolute;
            left: 20px;
            top: 50%;
            transform: translateY(-50%);
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            font-size: 18px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(10px);
        }

        .header h1 {
            font-size: 20px;
            font-weight: 600;
            margin: 0;
        }

        .achievements-content {
            padding: 20px;
        }

        /* 玩家信息卡片 */
        .player-card {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 20px;
            padding: 25px;
            margin-bottom: 20px;
            text-align: center;
            box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
            position: relative;
            overflow: hidden;
        }

        .player-card::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
            animation: float 6s ease-in-out infinite;
        }

        @keyframes float {
            0%, 100% { transform: translateY(0px) rotate(0deg); }
            50% { transform: translateY(-20px) rotate(180deg); }
        }

        .player-avatar {
            width: 80px;
            height: 80px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            margin: 0 auto 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 40px;
            backdrop-filter: blur(10px);
            border: 3px solid rgba(255, 255, 255, 0.3);
        }

        .player-name {
            font-size: 24px;
            font-weight: 700;
            margin-bottom: 8px;
        }

        .player-level {
            font-size: 16px;
            opacity: 0.9;
            margin-bottom: 20px;
        }

        .level-progress {
            background: rgba(255, 255, 255, 0.2);
            height: 8px;
            border-radius: 4px;
            overflow: hidden;
            margin-bottom: 15px;
        }

        .level-fill {
            background: linear-gradient(90deg, #ffd700 0%, #ffed4e 100%);
            height: 100%;
            width: 75%;
            border-radius: 4px;
            transition: width 0.3s ease;
        }

        .level-info {
            display: flex;
            justify-content: space-between;
            font-size: 14px;
            opacity: 0.8;
        }

        /* 成就统计 */
        .stats-section {
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(10px);
            border-radius: 18px;
            padding: 25px;
            margin-bottom: 20px;
            border: 1px solid rgba(233, 236, 239, 0.8);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        .stats-title {
            color: #495057;
            font-size: 18px;
            margin-bottom: 20px;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 12px;
            padding-bottom: 12px;
            border-bottom: 2px solid #e9ecef;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 15px;
        }

        .stat-item {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px;
            border-radius: 15px;
            text-align: center;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
            transition: transform 0.3s ease;
        }

        .stat-item:hover {
            transform: translateY(-5px);
        }

        .stat-value {
            font-size: 24px;
            font-weight: 700;
            margin-bottom: 8px;
        }

        .stat-label {
            font-size: 14px;
            opacity: 0.9;
        }

        /* 成就展示 */
        .achievements-section {
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(10px);
            border-radius: 18px;
            padding: 25px;
            margin-bottom: 20px;
            border: 1px solid rgba(233, 236, 239, 0.8);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        .achievements-title {
            color: #495057;
            font-size: 18px;
            margin-bottom: 20px;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 12px;
            padding-bottom: 12px;
            border-bottom: 2px solid #e9ecef;
        }

        .achievements-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 15px;
        }

        .achievement-item {
            text-align: center;
            padding: 20px 15px;
            border-radius: 15px;
            background: rgba(248, 249, 250, 0.8);
            transition: all 0.3s ease;
            border: 2px solid rgba(233, 236, 239, 0.6);
            position: relative;
            overflow: hidden;
        }

        .achievement-item:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
        }

        .achievement-item.unlocked {
            background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
            color: white;
            border-color: #28a745;
        }

        .achievement-item.unlocked::before {
            content: '✓';
            position: absolute;
            top: 8px;
            right: 8px;
            background: rgba(255, 255, 255, 0.9);
            color: #28a745;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: bold;
        }

        .achievement-item.rare {
            background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
            color: white;
            border-color: #ff6b6b;
        }

        .achievement-item.epic {
            background: linear-gradient(135deg, #9c88ff 0%, #6c5ce7 100%);
            color: white;
            border-color: #9c88ff;
        }

        .achievement-item.legendary {
            background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
            color: white;
            border-color: #fdcb6e;
        }

        .achievement-icon {
            font-size: 36px;
            margin-bottom: 12px;
        }

        .achievement-name {
            font-weight: 600;
            margin-bottom: 8px;
            font-size: 14px;
            line-height: 1.3;
        }

        .achievement-desc {
            font-size: 11px;
            opacity: 0.8;
            line-height: 1.3;
        }

        .achievement-item.unlocked .achievement-desc {
            opacity: 0.9;
        }

        /* 徽章收集 */
        .badges-section {
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(10px);
            border-radius: 18px;
            padding: 25px;
            margin-bottom: 20px;
            border: 1px solid rgba(233, 236, 239, 0.8);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        .badges-title {
            color: #495057;
            font-size: 18px;
            margin-bottom: 20px;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 12px;
            padding-bottom: 12px;
            border-bottom: 2px solid #e9ecef;
        }

        .badges-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 15px;
        }

        .badge-item {
            text-align: center;
            padding: 15px 10px;
            border-radius: 12px;
            background: rgba(248, 249, 250, 0.8);
            transition: all 0.3s ease;
            border: 2px solid rgba(233, 236, 239, 0.6);
        }

        .badge-item:hover {
            transform: scale(1.05);
        }

        .badge-item.unlocked {
            background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
            border-color: #ffd700;
            box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
        }

        .badge-icon {
            font-size: 28px;
            margin-bottom: 8px;
        }

        .badge-name {
            font-size: 11px;
            font-weight: 600;
            color: #495057;
            line-height: 1.2;
        }

        .badge-item.unlocked .badge-name {
            color: #8b6914;
        }

        /* 最近活动 */
        .activity-section {
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(10px);
            border-radius: 18px;
            padding: 25px;
            margin-bottom: 20px;
            border: 1px solid rgba(233, 236, 239, 0.8);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        .activity-title {
            color: #495057;
            font-size: 18px;
            margin-bottom: 20px;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 12px;
            padding-bottom: 12px;
            border-bottom: 2px solid #e9ecef;
        }

        .activity-list {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .activity-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px;
            background: rgba(248, 249, 250, 0.8);
            border-radius: 10px;
            border-left: 4px solid #667eea;
        }

        .activity-icon {
            font-size: 18px;
            color: #667eea;
        }

        .activity-content {
            flex: 1;
        }

        .activity-text {
            font-size: 14px;
            color: #495057;
            margin-bottom: 4px;
        }

        .activity-time {
            font-size: 12px;
            color: #6c757d;
        }

        /* 响应式设计 */
        @media (max-width: 480px) {
            .stats-grid {
                grid-template-columns: 1fr;
                gap: 12px;
            }

            .achievements-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 12px;
            }

            .badges-grid {
                grid-template-columns: repeat(3, 1fr);
                gap: 12px;
            }

            .player-avatar {
                width: 70px;
                height: 70px;
                font-size: 35px;
            }

            .player-name {
                font-size: 22px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <button class="back-btn" onclick="goBack()">←</button>
            <h1>我的成就</h1>
        </div>

        <div class="achievements-content">
            <!-- 玩家信息卡片 -->
            <div class="player-card">
                <div class="player-avatar">👤</div>
                <div class="player-name">龙虎斗玩家</div>
                <div class="player-level">等级 15</div>
                <div class="level-progress">
                    <div class="level-fill"></div>
                </div>
                <div class="level-info">
                    <span>经验值: 1,250</span>
                    <span>下一级: 1,600</span>
                </div>
            </div>

            <!-- 成就统计 -->
            <div class="stats-section">
                <h3 class="stats-title">
                    <span>📊</span>
                    成就统计
                </h3>
                <div class="stats-grid">
                    <div class="stat-item">
                        <div class="stat-value">8</div>
                        <div class="stat-label">已解锁成就</div>
                    </div>
                    <div class="stat-item">
                        <div class="stat-value">12</div>
                        <div class="stat-label">总成就数</div>
                    </div>
                    <div class="stat-item">
                        <div class="stat-value">67%</div>
                        <div class="stat-label">完成率</div>
                    </div>
                    <div class="stat-item">
                        <div class="stat-value">5</div>
                        <div class="stat-label">稀有成就</div>
                    </div>
                </div>
            </div>

            <!-- 成就展示 -->
            <div class="achievements-section">
                <h3 class="stats-title">
                    <span>🏆</span>
                    成就展示
                </h3>
                <div class="achievements-grid">
                    <div class="achievement-item unlocked">
                        <div class="achievement-icon">🎯</div>
                        <div class="achievement-name">初出茅庐</div>
                        <div class="achievement-desc">完成第一局游戏</div>
                    </div>
                    <div class="achievement-item unlocked">
                        <div class="achievement-icon">🔥</div>
                        <div class="achievement-name">连胜达人</div>
                        <div class="achievement-desc">连续获胜5局</div>
                    </div>
                    <div class="achievement-item">
                        <div class="achievement-icon">👑</div>
                        <div class="achievement-name">王者归来</div>
                        <div class="achievement-desc">达到最高等级</div>
                    </div>
                    <div class="achievement-item unlocked rare">
                        <div class="achievement-icon">💎</div>
                        <div class="achievement-name">百战不殆</div>
                        <div class="achievement-desc">完成100局游戏</div>
                    </div>
                    <div class="achievement-item epic">
                        <div class="achievement-icon">🌟</div>
                        <div class="achievement-name">传奇玩家</div>
                        <div class="achievement-desc">胜率达到80%</div>
                    </div>
                    <div class="achievement-item legendary">
                        <div class="achievement-icon">🚀</div>
                        <div class="achievement-name">速度之王</div>
                        <div class="achievement-desc">30秒内获胜</div>
                    </div>
                    <div class="achievement-item unlocked">
                        <div class="achievement-icon">🎮</div>
                        <div class="achievement-name">游戏达人</div>
                        <div class="achievement-desc">每日签到7天</div>
                    </div>
                    <div class="achievement-item">
                        <div class="achievement-icon">⚡</div>
                        <div class="achievement-name">闪电战</div>
                        <div class="achievement-desc">连续快速获胜</div>
                    </div>
                    <div class="achievement-item">
                        <div class="achievement-icon">🎲</div>
                        <div class="achievement-name">幸运星</div>
                        <div class="achievement-desc">连续翻出王牌</div>
                    </div>
                </div>
            </div>

            <!-- 徽章收集 -->
            <div class="badges-section">
                <h3 class="stats-title">
                    <span>🏅</span>
                    徽章收集
                </h3>
                <div class="badges-grid">
                    <div class="badge-item unlocked">
                        <div class="badge-icon">🥇</div>
                        <div class="badge-name">金牌</div>
                    </div>
                    <div class="badge-item unlocked">
                        <div class="badge-icon">🥈</div>
                        <div class="badge-name">银牌</div>
                    </div>
                    <div class="badge-item unlocked">
                        <div class="badge-icon">🥉</div>
                        <div class="badge-name">铜牌</div>
                    </div>
                    <div class="badge-item">
                        <div class="badge-icon">💎</div>
                        <div class="badge-name">钻石</div>
                    </div>
                    <div class="badge-item unlocked">
                        <div class="badge-icon">⭐</div>
                        <div class="badge-name">星星</div>
                    </div>
                    <div class="badge-item">
                        <div class="badge-icon">🌙</div>
                        <div class="badge-name">月亮</div>
                    </div>
                    <div class="badge-item">
                        <div class="badge-icon">☀️</div>
                        <div class="badge-name">太阳</div>
                    </div>
                    <div class="badge-item">
                        <div class="badge-icon">🌈</div>
                        <div class="badge-name">彩虹</div>
                    </div>
                </div>
            </div>

            <!-- 最近活动 -->
            <div class="activity-section">
                <h3 class="stats-title">
                    <span>📝</span>
                    最近活动
                </h3>
                <div class="activity-list">
                    <div class="activity-item">
                        <div class="activity-icon">🏆</div>
                        <div class="activity-content">
                            <div class="activity-text">解锁成就"百战不殆"</div>
                            <div class="activity-time">2分钟前</div>
                        </div>
                    </div>
                    <div class="activity-item">
                        <div class="activity-icon">📈</div>
                        <div class="activity-content">
                            <div class="activity-text">等级提升到15级</div>
                            <div class="activity-time">1小时前</div>
                        </div>
                    </div>
                    <div class="activity-item">
                        <div class="activity-icon">🎯</div>
                        <div class="activity-content">
                            <div class="activity-text">完成连胜挑战</div>
                            <div class="activity-time">3小时前</div>
                        </div>
                    </div>
                    <div class="activity-item">
                        <div class="activity-icon">💎</div>
                        <div class="activity-content">
                            <div class="activity-text">获得稀有徽章</div>
                            <div class="activity-time">昨天</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 返回上一页
        function goBack() {
            window.history.back();
        }

        // 应用主题颜色
        function applyTheme(theme) {
            console.log('我的成就页面应用主题:', theme);
            
            // 移除所有主题类
            const body = document.body;
            const allThemes = ['theme-blue', 'theme-green', 'theme-orange', 'theme-purple', 
                              'theme-pink', 'theme-red', 'theme-yellow', 'theme-cyan', 
                              'theme-lime', 'theme-indigo', 'theme-teal', 'theme-rose', 
                              'theme-amber', 'theme-emerald', 'theme-sky', 'theme-violet'];
            
            allThemes.forEach(themeClass => {
                body.classList.remove(themeClass);
            });
            
            // 添加新主题类
            if (theme && theme !== 'default') {
                body.classList.add('theme-' + theme);
                console.log('已应用主题类:', 'theme-' + theme);
            }
        }

        // 检查并同步主题
        function checkAndSyncTheme() {
            const savedTheme = localStorage.getItem('selectedTheme');
            const lastUpdateTime = localStorage.getItem('themeUpdateTime');
            
            if (savedTheme && lastUpdateTime) {
                console.log('检测到保存的主题:', savedTheme);
                applyTheme(savedTheme);
            }
        }

        // 监听主题变化
        function startThemeListener() {
            let lastThemeUpdateTime = localStorage.getItem('themeUpdateTime') || '0';
            
            // 定期检查主题更新
            setInterval(() => {
                const currentThemeUpdateTime = localStorage.getItem('themeUpdateTime') || '0';
                
                if (currentThemeUpdateTime !== lastThemeUpdateTime) {
                    console.log('检测到主题更新');
                    lastThemeUpdateTime = currentThemeUpdateTime;
                    
                    const savedTheme = localStorage.getItem('selectedTheme');
                    if (savedTheme) {
                        console.log('同步新主题:', savedTheme);
                        applyTheme(savedTheme);
                    }
                }
            }, 500);
        }

        // 页面加载时初始化
        document.addEventListener('DOMContentLoaded', function() {
            console.log('我的成就页面加载完成');
            
            // 检查并同步主题
            checkAndSyncTheme();
            
            // 启动主题监听器
            startThemeListener();
            
            // 监听页面可见性变化
            document.addEventListener('visibilitychange', function() {
                if (!document.hidden) {
                    console.log('页面变为可见，检查主题更新');
                    checkAndSyncTheme();
                }
            });
            
            console.log('主题同步功能已启动');
            console.log('当前保存的主题:', localStorage.getItem('selectedTheme'));
            console.log('主题更新时间:', localStorage.getItem('themeUpdateTime'));
        });
    </script>
</body>
</html>
